measureText
Type
function
Summary
Returns the width, size or bounds of the text drawn with the effective font attribute of the given object.
Syntax
measureText(<text>,<objectReference>,[<mode>])
Description
Use the measureText function to find the dimensions of the given text if drawn using the effective font attributes of the object specified in the objectReference parameter.
Parameters
Name | Type | Description |
---|---|---|
text | string | Any text string, or an expression that evaluates to a string. |
objectReference | string | An expression that evaluates to an object reference. |
mode | enum |
Examples
local tText, tTextWidth
put "Hello world" into tText
put measureText(tText,field "myField") into tTextWidth
local tText, tTextSize
put "Hello world" into field "someField"
put field "someField" into tText
put measureText(tText,field "someField","size") into tTextSize
# handler in a field
on textChanged
local tTextBounds
put measureText("foo",me,"bounds") into tTextBounds
put "The text in this field has these bounds: " & tTextBounds
end textChanged
Related
message: textChanged
property: formattedWidth, formattedHeight
control structure: function
glossary: return, expression, evaluate
Compatibility and Support
Introduced
LiveCode 6.5
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile